-
Notifications
You must be signed in to change notification settings - Fork 60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
batches: skip empty log output #923
Conversation
@@ -119,6 +119,14 @@ type prefixedWriter struct { | |||
func (w *prefixedWriter) Write(p []byte) (int, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just checked the source of p
and I think we will only ever stream 1 line at a time, either with the newline at the end, or not if the stream has ended and there is no newline (for example echo -n
).
So that makes me think that we shouldn't even split the p
in here at all - and would as a side-effect get that for free, while retaining actual empty log lines. How does that feel for you?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh! Yeah true - that's better. I can just remove the loop then. It makes sense to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should just re-validate that - but from reading code it seems like our scanner on the other end of this stream would write in line-chunks :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I just tested it, and it works. For both SSBC and local executions - the log output is consistent now.
Pushed a refactor.
a14db80
to
20ef19c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good stuff!
Co-authored-by: Erik Seliger <erikseliger@me.com>
Co-authored-by: Erik Seliger <erikseliger@me.com>
Test plan
I added a unit test for this.